package com.tf_cut.backend.seller.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.tf_cut.backend.request.BkcloudfundsComanagementPaymentNotifyRequest;
import com.tf_cut.backend.request.BkcloudfundsReceiptNotifyRequest;
import com.tf_cut.backend.request.CommomRequstHandle;
import com.tf_cut.backend.request.MybankNotifyService;
import com.tf_cut.backend.request.xml.XmlConverter;
import com.tf_cut.backend.seller.vo.ReceiptNotifyModel;
import com.tf_cut.backend.seller.vo.SellerGrantModel;
import com.tf_cut.backend.util.RequestHead;

@Service(value = "bkcloudfundsReceiptNotifyService")
public class GrantReceiptServiceImpl implements MybankNotifyService{
	
    @Autowired
    private CommomRequstHandle commomRequstHandle;

	@Override
	public String notifyHandle(String context, String function) throws Exception {
		//通知内容转换
		BkcloudfundsReceiptNotifyRequest comanagementPaymentNotifyRequest =
                XmlConverter.getInstance().toResponse(context, BkcloudfundsReceiptNotifyRequest.class);
        RequestHead head = comanagementPaymentNotifyRequest.getBkcloudfundsReceiptNotify().getRequestHead();
        //通知内容保存
        boolean flag = saveNotify(comanagementPaymentNotifyRequest.getBkcloudfundsReceiptNotify().getReceiptNotifyModel());
        String jieguo = commomRequstHandle.getSignResult(flag, head);
        System.out.println("返回结果="+jieguo);
        //响应结果根据执行结果统一处理
        return jieguo;
	}
	
	private boolean saveNotify(ReceiptNotifyModel model) {
		
		return true;
		
	}
    
    

}
